import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
import _isNil from "lodash/isNil";
import _isEmpty from "lodash/isEmpty";

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _class, _class2;

/* eslint-disable react/state-in-constructor */
import React, { Component } from 'react';
import { Dropdown, Checkbox, Popconfirm, Menu, Spin, Select, Table, Button, Form, Modal, InputNumber } from 'antd';
import { Bind, Debounce } from 'lodash-decorators';
import EditTable from "../../EditTable";
import { queryMapIdpValue } from "../../../services/api";
import notification from "../../../utils/notification";
import { getEditTableData } from "../../../utils/utils";
import intl from "../../../utils/intl";
import viewColumn from "../../../assets/view_column.svg";
import TLEditor from "../TLEditor";
import { queryUserCustConfig, saveUserCustConfig, resetUserCustConfig } from "../c7n/withCustomize/customizeTool";
import styles from "./style.less?modules";
var Option = Select.Option;
var FormItem = Form.Item;
var rowKey = 'fieldId';
var gridFixedMap = {
  L: 'left',
  R: 'right'
};
var CustModal = (_dec = Form.create({
  fieldNameProp: null
}), _dec2 = Bind(), _dec3 = Bind(), _dec4 = Bind(), _dec5 = Bind(), _dec6 = Bind(), _dec7 = Bind(), _dec8 = Bind(), _dec9 = Bind(), _dec10 = Bind(), _dec11 = Bind(), _dec12 = Bind(), _dec13 = Bind(), _dec14 = Bind(), _dec15 = Debounce(100), _dec16 = Bind(), _dec17 = Bind(), _dec18 = Bind(), _dec19 = Bind(), _dec20 = Bind(), _dec(_class = (_class2 = /*#__PURE__*/function (_Component) {
  _inherits(CustModal, _Component);

  var _super = _createSuper(CustModal);

  function CustModal() {
    var _this;

    _classCallCheck(this, CustModal);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _super.call.apply(_super, [this].concat(args));
    _this.state = {
      queryLoading: false,
      // 查询接口loading状态标识
      saveLoading: false,
      // 保存接口loading标识
      modifyFlag: false,
      // 是否修改标识
      activeUnitCode: null,
      fields: [],
      // 所有字段
      tableCols: [],
      // 表格列
      modifyConfig: {},
      // 最终配置,用于保存
      dropMenuVisible: false,
      dropMenuMouseEnterFlag: false,
      gridFixedOptions: [],
      tableChanging: false // 延迟

    };
    return _this;
  }

  _createClass(CustModal, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      this.fetchUserCustConfig();
      this.fetchLovData();
    }
  }, {
    key: "fetchUserCustConfig",
    value: function fetchUserCustConfig() {
      var _this2 = this;

      var activeUnitCode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
      this.setState({
        queryLoading: true
      });
      var _this$props$unit = this.props.unit,
          unit = _this$props$unit === void 0 ? [] : _this$props$unit;

      if (unit && unit.length > 0) {
        queryUserCustConfig({
          unitCode: unit.map(function (item) {
            return item.code;
          }).join(',')
        }).then(function (res) {
          if (res) {
            // 将传入的第一个作为单元设为默认
            _this2.setState({
              activeUnitCode: activeUnitCode || unit[0].code,
              modifyConfig: res || {}
            });

            _this2.initConfig(res[unit[0].code]);
          }

          _this2.setState({
            queryLoading: false
          });
        });
      } else {
        this.setState({
          queryLoading: false
        });
      }
    }
  }, {
    key: "fetchLovData",
    value: function fetchLovData() {
      var _this3 = this;

      queryMapIdpValue({
        gridFixedOptions: 'CPFM.CUST.GIRD.FIXED'
      }).then(function (res) {
        if (res) {
          _this3.setState({
            gridFixedOptions: res.gridFixedOptions || []
          });
        }
      });
    }
  }, {
    key: "initConfig",
    value: function initConfig(custConfig) {
      var _custConfig$config = custConfig.config,
          config = _custConfig$config === void 0 ? {} : _custConfig$config;
      var fields = custConfig.fields;
      var btnDisabled;

      if (!fields) {
        fields = [];
        btnDisabled = true;
      }

      if (_isEmpty(config)) {
        btnDisabled = true;
      }

      fields = this.sortColumnsOrder(fields);
      fields = this.adjustColumnsVisible(fields);
      var tableCols = [];
      fields.forEach(function (item) {
        var fieldId = item.fieldId,
            fieldCode = item.fieldCode,
            fieldName = item.fieldName,
            gridSeq = item.gridSeq,
            gridFixed = item.gridFixed,
            gridWidth = item.gridWidth,
            visible = item.visible,
            _tls = item._tls,
            _token = item._token;

        if (visible === 1) {
          tableCols.push({
            visible: visible,
            gridFixed: gridFixed,
            fieldCode: fieldCode,
            _tls: _tls,
            _token: _token,
            id: fieldId,
            fixed: gridFixedMap[gridFixed],
            title: fieldName,
            width: gridWidth,
            order: gridSeq,
            _status: 'update'
          });
        }
      });
      this.setState({
        fields: fields,
        tableCols: tableCols,
        btnDisabled: btnDisabled
      });
    } // 对列排序

  }, {
    key: "sortColumnsOrder",
    value: function sortColumnsOrder() {
      var columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
      var seqField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'gridSeq';
      var fixedField = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'gridFixed';
      // 按照列顺序字段seqField排序
      columns.sort(function (before, after) {
        if (!before[seqField] && !after[seqField]) {
          return 0;
        } else if (!before[seqField]) {
          return -1;
        } else if (!after[seqField]) {
          return 1;
        } else {
          return before[seqField] - after[seqField];
        }
      });
      var orderedColumns = columns; // 按照列固定字段gridFixed排序, 左固定前置,右固定后置

      var leftFixedColumns = orderedColumns.filter(function (item) {
        return ['L', 'left'].includes(item[fixedField]);
      });
      var rightFixedColumns = orderedColumns.filter(function (item) {
        return ['R', 'right'].includes(item[fixedField]);
      });
      var centerColumns = orderedColumns.filter(function (item) {
        return !['L', 'left', 'R', 'right'].includes(item[fixedField]);
      });
      orderedColumns = leftFixedColumns.concat(centerColumns).concat(rightFixedColumns);
      return orderedColumns;
    } // 处理列的显示隐藏属性

  }, {
    key: "adjustColumnsVisible",
    value: function adjustColumnsVisible() {
      var columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
      var _this$props$unit2 = this.props.unit,
          unit = _this$props$unit2 === void 0 ? [] : _this$props$unit2;
      var activeUnitCode = this.state.activeUnitCode;

      if (unit && unit.length > 0) {
        // 初始时设为第一个unit
        if (!activeUnitCode) {
          activeUnitCode = unit[0].code;
        }

        var currentUnit = unit.find(function (item) {
          return item.code === activeUnitCode;
        }) || {};
        var currentUnitColumns = currentUnit.columns || [];
        var newColumns = [];
        columns.forEach(function (item) {
          var newItem = item; // -1 原代码逻辑

          if (item.visible === -1) {
            // 传了原代码的columns
            if (!_isEmpty(currentUnitColumns)) {
              var targetUnitItem = currentUnitColumns.find(function (unitColumnsItem) {
                return unitColumnsItem.name === item.fieldCode;
              });

              if (targetUnitItem) {
                newItem.visible = targetUnitItem.hidden ? 0 : 1;
              }
            } else {
              // 未传原代码的columns
              newItem.visible = 1;
            }
          }

          newColumns.push(newItem);
        });
        return newColumns;
      }

      return columns;
    }
  }, {
    key: "changeFieldConfig",
    value: function changeFieldConfig(fieldCode, attribute) {
      var _this4 = this;

      var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
      var _this$state = this.state,
          activeUnitCode = _this$state.activeUnitCode,
          _this$state$modifyCon = _this$state.modifyConfig,
          modifyConfig = _this$state$modifyCon === void 0 ? {} : _this$state$modifyCon,
          _this$state$tableCols = _this$state.tableCols,
          tableCols = _this$state$tableCols === void 0 ? [] : _this$state$tableCols;
      var tableColsData = getEditTableData(tableCols);

      if (!_isEmpty(modifyConfig[activeUnitCode])) {
        var _modifyConfig$activeU = modifyConfig[activeUnitCode].fields,
            fields = _modifyConfig$activeU === void 0 ? [] : _modifyConfig$activeU;
        var changeFlag = false;
        var newFields = [];
        newFields = fields.map(function (fieldItem) {
          if (fieldItem.fieldCode === fieldCode) {
            var currentItem = tableColsData.find(function (colDataItem) {
              return colDataItem.fieldCode === fieldCode;
            });

            if (currentItem) {
              if (['gridFixed', 'title'].includes(attribute)) {
                currentItem[attribute] = value;
              }

              changeFlag = true;
              /*   // 多语言点开就会调用onChange,故保持changeFlag=true
              if (attribute === 'title') {
                changeFlag = true;
               // currentItem[attribute] = value;
              } else if (['width', 'order'].includes(attribute) && !isNaN(Number(value))) {
                const oldValue = fieldItem[attribute === 'width' ? 'gridWidth' : 'gridSeq'] || null;
                const newValue = Number(value) || null;
                if (oldValue !== newValue) {
                  changeFlag = true;
                 // currentItem[attribute] = newValue;
                }
              } else if (currentItem[attribute] !== value) {
                changeFlag = true;
               // currentItem[attribute] = value;
              } */

              var title = currentItem.title,
                  order = currentItem.order,
                  width = currentItem.width,
                  gridFixed = currentItem.gridFixed,
                  _tls = currentItem._tls; // eslint-disable-next-line  no-param-reassign

              fieldItem = _objectSpread(_objectSpread({}, fieldItem), {}, {
                gridFixed: gridFixed,
                _tls: _tls,
                fieldName: title,
                gridSeq: order,
                gridWidth: width
              });
            }
          }

          return fieldItem;
        });

        if (changeFlag) {
          modifyConfig[activeUnitCode].fields = newFields;
          this.setState({
            modifyConfig: modifyConfig,
            modifyFlag: true
          });
          this.initConfig(modifyConfig[activeUnitCode]); // 解决EditTable编辑框内数据遗留问题

          if (attribute !== 'title') {
            this.setState({
              tableChanging: true
            }, function () {
              _this4.setState({
                tableChanging: false
              });
            });
          }
        }
      }
    }
  }, {
    key: "changeFieldVisible",
    value: function changeFieldVisible(fieldCode) {
      var _this$state2 = this.state,
          activeUnitCode = _this$state2.activeUnitCode,
          _this$state2$modifyCo = _this$state2.modifyConfig,
          modifyConfig = _this$state2$modifyCo === void 0 ? {} : _this$state2$modifyCo;

      if (!_isEmpty(modifyConfig[activeUnitCode])) {
        var _modifyConfig$activeU2 = modifyConfig[activeUnitCode].fields,
            fields = _modifyConfig$activeU2 === void 0 ? [] : _modifyConfig$activeU2; // eslint-disable-next-line array-callback-return

        fields.find(function (item) {
          if (item.fieldCode === fieldCode) {
            // eslint-disable-next-line no-param-reassign
            item.visible = item.visible === 1 ? 0 : 1;
          }
        });
        modifyConfig[activeUnitCode].fields = fields;
        this.setState({
          modifyConfig: modifyConfig,
          modifyFlag: true
        });
        this.initConfig(modifyConfig[activeUnitCode]);
      }
    }
  }, {
    key: "changeUnit",
    value: function changeUnit(unitCode) {
      var _this5 = this;

      var _this$state3 = this.state,
          modifyConfig = _this$state3.modifyConfig,
          activeUnitCode = _this$state3.activeUnitCode,
          modifyFlag = _this$state3.modifyFlag;

      if (unitCode !== activeUnitCode) {
        if (modifyFlag) {
          Modal.confirm({
            content: intl.get('hcuz.custButton.view.message.delete.confirm').d('此页面有修改项尚未保存，确定要离开此页面？'),
            okText: intl.get('cpaas.common.button.sure').d('确定'),
            cancelText: intl.get('cpaas.common.button.cancel').d('取消'),
            onOk: function onOk() {
              // 解决EditTable编辑框内数据遗留问题
              _this5.setState({
                tableChanging: true
              }, function () {
                _this5.setState({
                  tableChanging: false,
                  activeUnitCode: unitCode,
                  modifyFlag: false
                });

                _this5.initConfig(modifyConfig[unitCode]);
              });
            }
          });
        } else {
          // 解决EditTable编辑框内数据遗留问题
          this.setState({
            tableChanging: true
          }, function () {
            _this5.setState({
              tableChanging: false,
              activeUnitCode: unitCode,
              modifyFlag: false
            });

            _this5.initConfig(modifyConfig[unitCode]);
          });
        }
      }
    }
  }, {
    key: "validateEditTableData",
    value: function validateEditTableData(editTableData) {
      var flag = true;

      if (Array.isArray(editTableData) && editTableData.length !== 0) {
        for (var i = 0; i < editTableData.length; i++) {
          if (editTableData[i].$form && editTableData[i]._status) {
            editTableData[i].$form.validateFieldsAndScroll({
              scroll: {
                allowHorizontalScroll: true
              }
            }, // eslint-disable-next-line no-loop-func
            function (err) {
              if (err) {
                flag = false;
              }
            });

            if (!flag) {
              break;
            }
          }
        }
      }

      return flag;
    }
  }, {
    key: "reset",
    value: function reset() {
      var _this6 = this;

      var _this$state4 = this.state,
          _this$state4$modifyCo = _this$state4.modifyConfig,
          modifyConfig = _this$state4$modifyCo === void 0 ? {} : _this$state4$modifyCo,
          activeUnitCode = _this$state4.activeUnitCode;
      var _modifyConfig$activeU3 = modifyConfig[activeUnitCode].config,
          config = _modifyConfig$activeU3 === void 0 ? {} : _modifyConfig$activeU3;
      this.setState({
        resetLoading: true
      });

      if (!_isEmpty(config)) {
        resetUserCustConfig({
          unitId: config.unitId
        }).then(function (res) {
          if (!_isNil(res)) {
            notification.success();

            _this6.fetchUserCustConfig(activeUnitCode);
          }

          _this6.setState({
            resetLoading: false
          });
        });
      }
    }
  }, {
    key: "save",
    value: function save() {
      var _this7 = this;

      var _this$state5 = this.state,
          modifyConfig = _this$state5.modifyConfig,
          activeUnitCode = _this$state5.activeUnitCode,
          tableCols = _this$state5.tableCols;
      var flag = this.validateEditTableData(tableCols);

      if (flag) {
        var fields = modifyConfig[activeUnitCode].fields || [];
        var newFields = [];

        if (fields.length > 0) {
          newFields = fields.map(function (fieldItem) {
            if (fieldItem._tls && fieldItem._tls.fieldName && !fieldItem._tls.fieldName.zh_CN) {
              // eslint-disable-next-line no-param-reassign
              fieldItem._tls.fieldName.zh_CN = fieldItem.fieldName;
            }

            return fieldItem;
          });
        }

        modifyConfig[activeUnitCode].fields = newFields;
        var params = modifyConfig[activeUnitCode];
        this.setState({
          saveLoading: true
        });
        saveUserCustConfig(params).then(function (res) {
          if (res) {
            notification.success();
            var _this7$props$handleCl = _this7.props.handleClose,
                handleClose = _this7$props$handleCl === void 0 ? function () {} : _this7$props$handleCl;
            handleClose();
          }

          _this7.setState({
            saveLoading: false
          });
        });
      }
    }
  }, {
    key: "cancle",
    value: function cancle() {
      var _this$props$handleClo = this.props.handleClose,
          handleClose = _this$props$handleClo === void 0 ? function () {} : _this$props$handleClo;
      handleClose();
    }
  }, {
    key: "toggleDropMenu",
    value: function toggleDropMenu() {
      this.setState({
        dropMenuVisible: true
      });
    }
  }, {
    key: "hiddenDropMenu",
    value: function hiddenDropMenu() {
      var dropMenuMouseEnterFlag = this.state.dropMenuMouseEnterFlag; // 防抖

      if (!dropMenuMouseEnterFlag) {
        this.setState({
          dropMenuVisible: false
        });
      }
    }
  }, {
    key: "toggleMouseEnterFlag",
    value: function toggleMouseEnterFlag() {
      this.setState({
        dropMenuMouseEnterFlag: true
      });
    }
  }, {
    key: "clearMouseEnterFlag",
    value: function clearMouseEnterFlag() {
      this.setState({
        dropMenuMouseEnterFlag: true,
        dropMenuVisible: false
      });
    }
  }, {
    key: "getCustFieldsColumns",
    value: function getCustFieldsColumns() {
      var _this8 = this;

      var _this$state$gridFixed = this.state.gridFixedOptions,
          gridFixedOptions = _this$state$gridFixed === void 0 ? [] : _this$state$gridFixed;
      return [{
        title: intl.get('hcuz.custButton.view.title.columnName').d('列名'),
        dataIndex: 'title',
        render: function render(val, record) {
          return /*#__PURE__*/React.createElement(FormItem, null, record.$form.getFieldDecorator('title', {
            rules: [{
              required: true,
              message: intl.get('cpaas.common.validation.notNull', {
                name: intl.get('hcuz.custButton.view.title.columnName').d('列名')
              })
            }],
            initialValue: val
          })( /*#__PURE__*/React.createElement(TLEditor, {
            label: intl.get('hcuz.custButton.view.title.columnName').d('列名'),
            field: "fieldName",
            data: record._tls,
            token: record._token,
            onChange: function onChange(value) {
              return _this8.changeFieldConfig(record.fieldCode, 'title', value);
            }
          })));
        }
      }, {
        title: intl.get('hcuz.custButton.view.title.position').d('位置'),
        dataIndex: 'order',
        width: 150,
        render: function render(val, record) {
          return /*#__PURE__*/React.createElement(FormItem, null, record.$form.getFieldDecorator('order', {
            initialValue: val
          })( /*#__PURE__*/React.createElement(InputNumber, {
            min: 0,
            onBlur: function onBlur(value) {
              return _this8.changeFieldConfig(record.fieldCode, 'order', value);
            }
          })));
        }
      }, {
        title: intl.get('hcuz.custButton.view.title.columnWidth').d('列宽'),
        dataIndex: 'width',
        width: 150,
        render: function render(val, record) {
          return /*#__PURE__*/React.createElement(FormItem, null, record.$form.getFieldDecorator('width', {
            initialValue: val
          })( /*#__PURE__*/React.createElement(InputNumber, {
            min: 0,
            onBlur: function onBlur(value) {
              return _this8.changeFieldConfig(record.fieldCode, 'width', value);
            }
          })));
        }
      }, {
        title: intl.get('hcuz.custButton.view.title.fixed').d('冻结'),
        dataIndex: 'gridFixed',
        width: 150,
        render: function render(val, record) {
          return /*#__PURE__*/React.createElement(FormItem, null, record.$form.getFieldDecorator('gridFixed', {
            initialValue: val
          })( /*#__PURE__*/React.createElement(Select, {
            allowClear: true,
            onChange: function onChange(value) {
              return _this8.changeFieldConfig(record.fieldCode, 'gridFixed', value);
            }
          }, gridFixedOptions.map(function (firxedItem) {
            return /*#__PURE__*/React.createElement(Option, {
              key: firxedItem.value,
              value: firxedItem.value
            }, firxedItem.meaning);
          }))));
        }
      }];
    }
  }, {
    key: "renderUnit",
    value: function renderUnit() {
      var _this9 = this;

      var _this$state6 = this.state,
          activeUnitCode = _this$state6.activeUnitCode,
          modifyConfig = _this$state6.modifyConfig;
      return Object.keys(modifyConfig).map(function (item) {
        return /*#__PURE__*/React.createElement("div", {
          key: item,
          className: activeUnitCode === item ? styles['cust-unit-active'] : styles['cust-unit'],
          onClick: function onClick() {
            return _this9.changeUnit(item);
          }
        }, /*#__PURE__*/React.createElement("div", {
          className: styles['cust-unit-name']
        }, modifyConfig[item].unitName), /*#__PURE__*/React.createElement("div", {
          className: styles['cust-unit-code']
        }, item));
      });
    }
  }, {
    key: "render",
    value: function render() {
      var _this10 = this;

      var _this$state7 = this.state,
          _this$state7$fields = _this$state7.fields,
          fields = _this$state7$fields === void 0 ? [] : _this$state7$fields,
          _this$state7$tableCol = _this$state7.tableCols,
          tableCols = _this$state7$tableCol === void 0 ? [] : _this$state7$tableCol,
          _this$state7$tableCha = _this$state7.tableChanging,
          tableChanging = _this$state7$tableCha === void 0 ? false : _this$state7$tableCha,
          _this$state7$dropMenu = _this$state7.dropMenuVisible,
          dropMenuVisible = _this$state7$dropMenu === void 0 ? false : _this$state7$dropMenu,
          _this$state7$queryLoa = _this$state7.queryLoading,
          queryLoading = _this$state7$queryLoa === void 0 ? false : _this$state7$queryLoa,
          _this$state7$saveLoad = _this$state7.saveLoading,
          saveLoading = _this$state7$saveLoad === void 0 ? false : _this$state7$saveLoad,
          _this$state7$resetLoa = _this$state7.resetLoading,
          resetLoading = _this$state7$resetLoa === void 0 ? false : _this$state7$resetLoa,
          _this$state7$btnDisab = _this$state7.btnDisabled,
          btnDisabled = _this$state7$btnDisab === void 0 ? false : _this$state7$btnDisab;
      var menu = /*#__PURE__*/React.createElement(Menu, {
        className: styles['cust-col-dropDown-menu'],
        onMouseEnter: this.toggleMouseEnterFlag,
        onMouseLeave: this.clearMouseEnterFlag
      }, fields.map(function (item) {
        return /*#__PURE__*/React.createElement(Menu.Item, {
          key: item.fieldId,
          onClick: function onClick() {
            return _this10.changeFieldVisible(item.fieldCode);
          },
          className: styles['cust-col-dropDown-menu-item']
        }, /*#__PURE__*/React.createElement(Checkbox, {
          checked: item.visible === 1
        }), " ", item.fieldName);
      }));
      return /*#__PURE__*/React.createElement(Spin, {
        spinning: queryLoading || saveLoading || resetLoading
      }, /*#__PURE__*/React.createElement("div", {
        className: styles['modal-content']
      }, /*#__PURE__*/React.createElement("div", {
        className: styles['modal-content-left']
      }, /*#__PURE__*/React.createElement("header", {
        className: styles['modal-content-left-title']
      }, intl.get('hcuz.custButton.view.title.individuationTableUnit').d('个性化表格单元')), this.renderUnit()), /*#__PURE__*/React.createElement("div", {
        className: styles['modal-content-right']
      }, /*#__PURE__*/React.createElement("div", {
        className: styles['cust-preview']
      }, intl.get('hcuz.custButton.view.title.preview').d('预览效果')), /*#__PURE__*/React.createElement("div", {
        className: styles['cust-preview-table']
      }, /*#__PURE__*/React.createElement(Table, {
        bordered: true,
        rowKey: rowKey,
        pagination: false,
        columns: tableCols
      })), /*#__PURE__*/React.createElement("div", {
        className: styles['cust-field']
      }, intl.get('hcuz.custButton.view.title.field').d('字段'), /*#__PURE__*/React.createElement("div", {
        className: styles['cust-col-dropDown-div']
      }, /*#__PURE__*/React.createElement("span", {
        className: styles['cust-col-dropDown-div-title']
      }, intl.get('hcuz.custButton.view.title.tableCol').d('表格字段'), ":"), /*#__PURE__*/React.createElement(Dropdown, {
        overlay: menu,
        placement: "bottomRight",
        visible: dropMenuVisible
      }, /*#__PURE__*/React.createElement("img", {
        src: viewColumn,
        alt: "img",
        onMouseEnter: this.toggleDropMenu,
        onMouseLeave: this.hiddenDropMenu
      })))), !tableChanging && /*#__PURE__*/React.createElement(EditTable, {
        className: styles['cust-col-table'],
        pagination: false,
        dataSource: tableCols,
        columns: this.getCustFieldsColumns()
      }))), /*#__PURE__*/React.createElement("div", {
        className: styles['modal-footer']
      }, /*#__PURE__*/React.createElement(Button, {
        icon: "close",
        onClick: this.cancle,
        disabled: saveLoading || resetLoading
      }, intl.get('cpaas.common.button.cancel').d('取消')), /*#__PURE__*/React.createElement(Popconfirm, {
        title: intl.get('hcuz.custButton.view.button.confirmRestore').d('是否确认还原？'),
        onConfirm: this.reset,
        okText: intl.get('cpaas.common.status.yes').d('是'),
        cancelText: intl.get('cpaas.common.status.no').d('否')
      }, /*#__PURE__*/React.createElement(Button, {
        icon: "reload" //   onClick={this.reset}
        ,
        loading: resetLoading,
        disabled: btnDisabled || saveLoading
      }, intl.get('hcuz.custButton.view.button.restore').d('还原'))), /*#__PURE__*/React.createElement(Button, {
        icon: "save",
        type: "primary",
        onClick: this.save,
        loading: saveLoading,
        disabled: btnDisabled || resetLoading
      }, intl.get('cpaas.common.button.save').d('保存'))));
    }
  }]);

  return CustModal;
}(Component), (_applyDecoratedDescriptor(_class2.prototype, "fetchUserCustConfig", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchUserCustConfig"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchLovData", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchLovData"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "initConfig", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "initConfig"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "sortColumnsOrder", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "sortColumnsOrder"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "adjustColumnsVisible", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "adjustColumnsVisible"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "changeFieldConfig", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "changeFieldConfig"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "changeFieldVisible", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "changeFieldVisible"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "changeUnit", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "changeUnit"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "validateEditTableData", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "validateEditTableData"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "reset", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "reset"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "save", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "save"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "cancle", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "cancle"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleDropMenu", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleDropMenu"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "hiddenDropMenu", [_dec15, _dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "hiddenDropMenu"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "toggleMouseEnterFlag", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "toggleMouseEnterFlag"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "clearMouseEnterFlag", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "clearMouseEnterFlag"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "getCustFieldsColumns", [_dec19], Object.getOwnPropertyDescriptor(_class2.prototype, "getCustFieldsColumns"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "renderUnit", [_dec20], Object.getOwnPropertyDescriptor(_class2.prototype, "renderUnit"), _class2.prototype)), _class2)) || _class);
export { CustModal as default };